package compi2.practica1.lex;

import java_cup.runtime.Symbol;
import java.util.ArrayList;
import compi2.practica1.utils.TokenListCSS;
%%
  
%cupsym TokenListCSS
%cup
%class LexCSS		    /* Nombre de clase */
%unicode 				/* Formato de Files */
%public					/* Clase publica */
%line    				/* Numero de linea */
%char					/* Numero de columna */
%ignorecase

letter 		= [a-zA-ZñÑáéíóú]+
number  	= [0-9]+
id			= {letter}({letter}|{number}|"_")*
text		= [\"] [^\"\n]* [\"\n]
coma		= [,]
twopoint	= [:]
pointcoma	= [;]

%%

[{]										{System.out.println(yytext()); return new Symbol(TokenListCSS.oclass          , yychar, yyline, new String(yytext())); }
[}]										{System.out.println(yytext()); return new Symbol(TokenListCSS.cclass          , yychar, yyline, new String(yytext())); }
"attribute"								{System.out.println(yytext()); return new Symbol(TokenListCSS.oattributes     , yychar, yyline, new String(yytext())); }
"method"								{System.out.println(yytext()); return new Symbol(TokenListCSS.omethods        , yychar, yyline, new String(yytext())); }
"relation"								{System.out.println(yytext()); return new Symbol(TokenListCSS.orelation       , yychar, yyline, new String(yytext())); }
"parameter"								{System.out.println(yytext()); return new Symbol(TokenListCSS.oparameter      , yychar, yyline, new String(yytext())); }

{coma}									{System.out.println(yytext()); return new Symbol(TokenListCSS.coma			  , yychar, yyline, new String(yytext())); }
{twopoint}								{System.out.println(yytext()); return new Symbol(TokenListCSS.twopoint		  , yychar, yyline, new String(yytext())); }
{pointcoma}								{System.out.println(yytext()); return new Symbol(TokenListCSS.pointcoma		  , yychar, yyline, new String(yytext())); }


{id}									{System.out.println(yytext()); return new Symbol(TokenListCSS.variable        , yychar, yyline, new String(yytext())); }
{text}									{System.out.println(yytext()); return new Symbol(TokenListCSS.text            , yychar, yyline, new String(yytext())); }

[\t\r\n\f]+						{}
" "								{}
.					          	{System.out.println(yytext()); return new Symbol(TokenListCSS.error , yychar, yyline, new String(yytext())); }